package myzd.client;

import libedge.domain.request.ResultWrapper;
import myzd.api.domain.ListResult;
import myzd.client.domain.AccessTokenResponse;
import myzd.domain.QiYeEmployee;
import myzd.domain.response.Department;
import retrofit2.Call;
import retrofit2.http.GET;
import retrofit2.http.POST;
import retrofit2.http.Path;
import retrofit2.http.Query;

/**
 * @author zks
 */
public interface WeChatQiYeClient {
  @GET("internal/api/v1/departments")
  Call<ResultWrapper<ListResult<Department>>> getGroupList();

  @GET("internal/api/v1/users")
  Call<ResultWrapper<ListResult<QiYeEmployee>>> getUserList();

  @GET("internal/api/v1/departments/{departmentId}/users")
  Call<ResultWrapper<ListResult<QiYeEmployee>>> listUsersInDepartment(
    @Path("departmentId") int departmentId,
    @Query("inService") Boolean inService
  );

  @GET("internal/api/v1/users/{staffId}")
  Call<ResultWrapper<QiYeEmployee>> getUserByStaffId(@Path("staffId") String staffId);

  @POST("oauth2/{agent}/token")
  Call<AccessTokenResponse> accessToken(
    @Path("agent") String agentId,
    @Query("code") String code,
    @Query("client_id") String clientId,
    @Query("client_secret") String clientSecret
  );
}
